23. Quiz: Clean (Test)

Clean: Test

Using Programmatic Assessments to Test

Clean: Test 1

Note: In the video above and the next two videos, you may notice that the body of the for loop in the "Clean (Code 2)" concept uses .ix rather than .replace . Please ignore this inconsistency. There are often multiple ways to get a cleaning task accomplished in pandas, and .ix works, but it is now deprecated and .replace is more concise for this task.

Quiz 1

Use the .value_counts() method in the Jupyter Notebook below to verify that all of the similar phrases were converted to ASAP. How many StartDate entries are 'ASAP' now? Answer this question in the subsequent quiz.

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: jupyter
  • Opened files (when workspace is loaded): n/a

Quiz: Test

QUESTION:

How many 'ASAP' StartDate entries do we have after the standardization?

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

Solution 1 and Quiz 2

Clean: Test 1 Solution

Assert Statements

In the Jupyter Notebook below, write an assert statement to verify that none of the phrases similar to 'ASAP' remain in the StartDate column, which implies that they were converted to 'ASAP'.

Here is a helpful tutorial on assertions in Python if you're stuck.

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: jupyter
  • Opened files (when workspace is loaded): n/a

Quiz: Assert

QUESTION:

Get your code to work in the Jupyter Notebook above, then fill in the for loop body's assert statement (to test the 'ASAP' standardization code) in the text box below.

Hint: series.values will come in handy.

SOLUTION:

NOTE: The solutions are expressed in RegEx pattern. Udacity uses these patterns to check the given answer

Solution 2

Clean: Test 2